<%#
  # WebROaR - Ruby Application Server - http://webroar.in/
  # Copyright (C) 2009  Goonj LLC
  #
  # This file is part of WebROaR.
  #
  # WebROaR is free software: you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation, either version 3 of the License, or
  # (at your option) any later version.
  #
  # WebROaR is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  #
  # You should have received a copy of the GNU General Public License
  # along with WebROaR.  If not, see <http://www.gnu.org/licenses/>.
  #%>
<% expires = Headers.get_expires_value() %>  
<table width = 95% align='center'>
    <tr>
        <th colspan = 3>
            Headers&nbsp;&nbsp;&nbsp;<%= link_to_function "Help", :onclick => "addHelp('headers',event)" %>
        </th>
    </tr>    
    <tr>
        <td width = 40% >
            Expires&nbsp;&nbsp;&nbsp;<%= link_to_function "Help", :onclick => "addHelp('expires',event)" %>
        </td>
        <td width = 40% >
            <div id = 'expires_div'>
                <%= expires %>
            </div>
        </td>
        <td width = 20% >
            <%= link_to_remote 'Edit', :update => 'expires_div', :url => {:controller => 'headers', :action => 'add_expires_text_box', :div_id => 'expires_div'} %>
        </td>
    </tr>
		<tr>
			<th colspan = 3>
				Expires By Type&nbsp;&nbsp;&nbsp;<%= link_to_function "Help", :onclick => "addHelp('expires_by_type',event)" %>
			</th>
		</tr>
		<% expires_by_type_array = Headers.get_expires_by_type_array() %>		
		<% if expires_by_type_array.length > 0 %>
		<tr>
			<td class = 'sub_header text_align_center'>
        Extension&nbsp;&nbsp;&nbsp;<%= link_to_function "Help", :onclick => "addHelp('expires_by_type_ext',event)" %>
			</td>
			<td class = 'sub_header text_align_center'>
				Expires&nbsp;&nbsp;&nbsp;<%= link_to_function "Help", :onclick => "addHelp('expires_by_type_expires_value',event)" %>                
      </td>
      <td class = 'sub_header text_align_center'></td>
		</tr>
		<% index = 0 %>
		<% expires_by_type_array.each do |item| %>
		  <tr>
		  	<td >
		  		<%= item['ext'] %>
		  	</td>
				<td >
          <%= item['expires'] %>
        </td>
				<td >
          <%= link_to_remote "Delete", :update => 'headers_div', :url => {:controller => 'headers', :action => 'delete_expires_by_type', :id => index}, :confirm => "Are you sure to delete?", :oncontextmenu => 'return false;' %>
        </td>
		  </tr>
			<% index += 1%>
		  <% end %>
		<% end %>
		<tr>
		  <td style="padding:0px;" colspan='3'><div id = 'expires_by_type_form'></div></td>
		</tr>
  	<% if @restart_server_message %>
		<tr>
		  <td class='error' colspan='3'>
        <%= @restart_server_message%>
      </td>
    </tr>
		<% end %>			
		<tr>
			<td style="text-align:right;" colspan='3'>
				<%= link_to_remote "Add Expires By Type", :update => 'expires_by_type_form', :url => {:controller => 'headers', :action => 'add_expires_by_type_form'} %>			  
			</td>
		</tr>
</table>